package com.fanbuchi.fukua.validate;

import android.text.TextUtils;
import android.util.SparseArray;

import com.fanbuchi.fukua.entity.UserEntity;

import java.util.Map;

/**
 * Created by Administrator on 2015/10/23.
 * @title
 */
public class RegValidate implements ValidateValue{

    public static SparseArray<String> createUserValidate(UserEntity user){
        SparseArray<String> _result= new SparseArray<>();
        if (TextUtils.isEmpty(user.getUserName())){
            _result.put(userName_notNull_code,userName_notNull_desc);
        }else if (user.getUserName().length()>15){
            _result.put(userName_long_code,userName_long_desc);
        }else if (user.getUserName().length()<2) {
            _result.put(userName_short_code,userName_short_desc);
        }else if (TextUtils.isEmpty(user.getPassword())) {
            _result.put(pass_notNull_code,pass_notNull_desc);
        }else if (user.getPassword().length()<6) {
            _result.put(pass_short_code,pass_short_desc);
        }
        return _result;
    }
}
